{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% if ea().crud.currentAction == 'detail' %}
    {{ field.formattedValue|nl2br }}
{% else %}
    {% set html_id = 'ea-text-editor-' ~ field.uniqueId %}
    <a href="#" data-bs-toggle="modal" data-bs-target="#{{ html_id }}">
        <twig:ea:Icon name="internal:file-lines" /> {{ 'field.text_editor.view_content'|trans([], domain: 'EasyAdminBundle') }}
    </a>

    <div class="modal fade" id="{{ html_id }}" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header d-flex justify-content-between">
                    <h5 class="modal-title">{{ field.label|trans }}</h5>
                    <twig:ea:Button type="button" isInvisible icon="internal:xmark" data-bs-dismiss="modal" aria-label="{{ 'action.close'|trans([], domain: 'EasyAdminBundle') }}" />
                </div>
                <div class="modal-body">
                    {{ field.formattedValue|nl2br }}
                </div>
            </div>
        </div>
    </div>
{% endif %}
